package com.injection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

/**
 * Created by
 *
 * @author touni
 * @date 2019/4/11
 * @time 10:48
 */
@RestController
public class DemoController {

    @Autowired
    private DataSource dataSource;  //


    @RequestMapping("/index")
    public String demo() throws SQLException {
        System.out.println(dataSource);
        Connection connection = dataSource.getConnection();


        return "Hello injection";

    }


}
